package com.ynet.middleground.oss.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ynet.middleground.oss.dao.OauthUserRoleMapper;

/**
 * @author liulx
 * @description TODO: 测试使用
 * @date 2020-10-13 09:28
 */
@RestController
public class TestController {

    @Autowired
    OauthUserRoleMapper oauthUserRoleMapper;

    @RequestMapping("/test")
    public List<Map<String, Object>> test(Integer userId) {
        List<Map<String, Object>> list = oauthUserRoleMapper.listRolesByUserId(userId);
        return list;
    }

    public static void main(String[] args) {
        String pwd = "password";
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String encodePwd = encoder.encode(pwd);
        System.out.println(encodePwd);
        System.out.println(encoder.matches(pwd, encodePwd));
    }

}
